for _,v in ipairs({
    Asset("ATLAS","images/pedia/bg.xml"),
    Asset("ATLAS","images/pedia/icon.xml"),
    Asset("ATLAS","images/pedia/inv_slot.xml"),
    Asset("ATLAS","images/pedia/lock.xml"),
    Asset("ATLAS","images/pedia/oneitem_list_bg.xml"),
    Asset("ATLAS","images/pedia/scrollbar.xml"),
    Asset("ATLAS","images/pedia/ingredient_bg.xml"),
}) do
    table.insert( Assets,v)
end

local ImageButton = require 'widgets/imagebutton'
local kukude_pedia = require 'core_kukude/widgets/kukude_pedia'

AddClassPostConstruct('screens/playerhud',function(self)
    if ThePlayer and ThePlayer.prefab and ThePlayer.prefab == 'kukude' then
        ---@type widget_kukude_pedia
        self.kukude_pedia = self:AddChild(kukude_pedia())
        self.kukude_pedia:HidePedia()

        ---@type widget_imagebutton
        self.kukude_pedia_logo = self:AddChild(ImageButton('images/pedia/icon.xml', 'icon.tex','icon.tex','icon.tex','icon.tex','icon.tex'))
        self.kukude_pedia_logo:SetPosition(68+45,27+45)
        self.kukude_pedia_logo:SetScale(1.2,1.2)
        self.kukude_pedia_logo:SetOnClick(function()
            if self.kukude_pedia then
                if self.kukude_pedia.shown then
                    self.kukude_pedia:HidePedia()
                    ThePlayer.is_checking_kukude_pedia = false
                else
                    self.kukude_pedia:ShowPedia()
                    ThePlayer.is_checking_kukude_pedia = true
                end
            end
        end)
        self.kukude_pedia_logo.OnMouseButton = function(_self, button, down, x, y,...)
            if button == MOUSEBUTTON_RIGHT and down then
                self.kukude_pedia_logo:FollowMouse()
            else
                self.kukude_pedia_logo:StopFollowMouse()
                -- self.kukude_pedia_logo:SetPosition(TheInput:GetScreenPosition())
            end
        end
    end
end)